/* Sample UDP server */

#include <sys/socket.h>
#include <stdio.h>
#include <strings.h>
#include <iostream>
#include <stdio.h>
#include <strings.h>
#include <string>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#include <fstream>

#include <openssl/evp.h>
#include <openssl/hmac.h>




std::string hmac(std::string const& data) {
	char key[] = "012345678";
	unsigned char* digest;

	digest = HMAC(EVP_sha1(), key, 9, (unsigned char*)data.c_str(), data.size(), NULL, NULL);

	char mdString[20];
	for(int i = 0; i < 10; i++) {
		sprintf(&mdString[i*2], "%02x", (unsigned int)digest[i]);

	}

	std::string hmacValue;
	hmacValue.append(mdString,20);

	return hmacValue;
}



